<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no" />
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="../c/aui.css" />
	<style>
		body {
			background-color: transparent;
			background: url('../i/bg.gif');
			outline: 0;
		}
		#loadingdi_huifu-s {
			display: flex;
			width: 100%;
			justify-content: center;
			align-items: center;
			height: 500px;
			text-align: center;
			margin: 0 auto;
			flex-direction: column;
			opacity: 1;
		}
		#loadingdi_huifu-s img {
			width: 2rem;
			height: 2rem;
		}
		#loadingdi_huifu-s div {
			padding-top: 1rem;
			font-size: 0.8rem;
			text-shadow:1px 2px 5px #fff;
			line-height: 1.5rem;
		}
	</style>
</head>

<body>
	<div id="loadingdi_huifu-s"><img src="../i/footer_progress.png" />
		<!-- <div>出售APP短视频源码<br />微信/电话: 156 2228 9461</div> -->
	</div>
</body>
<script type="text/javascript" src="../j/api.js"></script>
<script type="text/javascript">
	var scrollVideo, _right_h, _right_r,di_data,video_index_p,video_index_i,video_index_xh,ad_list_video,_root=1;
	var list_data = [];
	var video_url_ajax = 'video/lists/limit/51';
	apiready = function() {
		// 在列表尾数插入广告视频
		ad_list_video = _getPrefs('_config').ad.ad_list_video;
		video_index_i = video_index_xh = 0;
		video_index_p = 1;
		$api.css($api.byId('loadingdi_huifu-s'), 'height:' + (api.winHeight - 100) + 'px');
		if (api.winName == 'scrollVideo') {
			url = 'close'
			api.openFrame({
				name: url,
				url: _h_w + url + '.html',
				rect: {
					x: 0,
					y: api.safeArea.top,
					w: 60,
					h: 60,
				},
				bgColor: 'rgba(0,0,0,0)',
			})
		}
		scrollVideo = api.require('scrollVideo');
		scrollVideo.addEventListener(function(ret, err) {
			switch (ret.evenType) {
				case 'onPageSelected':
				//	 console.log('当前播放页')
					//  if((video_index-1) <= video_index_xh){
 				// 		// 记录上一次播放序号
 				// 		video_index++;
 				// 		add();
 				// 	}
						//	console.log(JSON.stringify(ret) + "   " + JSON.stringify(err));
					break;
				case 'onErrorVideo':
				// console.log(JSON.stringify(ret) + "   " + JSON.stringify(err));
					console.log(ret.evenType)
					_alert('视频不存在或作者已删除');
					break;
				case 'onBufferingStart':
					// console.log('缓冲开始')
					//  if((video_index-1) <= video_index_xh){
 				// 		// 记录上一次播放序号
 				// 		video_index++;
 				// 		add();
 				// 	}
					break;
				case 'onBufferingEnd':
				//	 console.log('缓冲结束')
					//  if((video_index-1) <= video_index_xh){
 				// 		// 记录上一次播放序号
 				// 		video_index++;
 				// 		add();
 				// 	}
					api.closeFrame({
						name: 'isPlaying'
					});
					break;
				case 'onSingleTapUp':
					console.log('单击事件')
					if (scrollVideo.isPlaying().isPlaying) {
						isPlaying();
					} else {
						isPlaying(true);
					}
					//	console.log(JSON.stringify(ret))
					break;
				case 'onDoubleTap':
					styles(ret);
					console.log('双击事件')
					break;
				case 'onLongPress':
					console.log('长按事件')
					break;
				case 'onUpSlideComplet':
					console.log('上滑完成事件')
					break;
				case 'onDownwardSlideComplet':
					console.log('下滑完成事件')
					break;
				case 'onBtnClick':
					console.log('按钮点击事件')
					styles(ret);
					break;
				case 'onTextClick':
					console.log('文字点击事件');
					styles(ret);
					break;
				case 'onSwitchPlayer':
					console.log('大小播放器切换事件')
					break;
				case 'onMoveLeft':
					console.log('向左滑过事件');
					_u(di_data.uid);
					break;
				case 'onMoveRight':
					console.log('向右滑过事件');

					break;
				case 'onPrepared':
			//	console.log("list_data:"+list_data.length)
					di_data = ret.itemData.video;
					// console.log(JSON.stringify(di_data.id))
				//	console.log((video_index_p*5) +" : "+ video_index_i)
					if((video_index_p*3) <= video_index_i){

						if(_getPrefs('_config').ad.ad){

								if(_getPrefs('_config').ad.kaiping == 2 && ad_vip){
									video_index_p++;
									_url({
										animation: true,
										js: 'kaiping',
										time_jinbi: time_jinbi,
										time_jinbi_name: api.winName,
										time_jinbi_frameName: api.frameName
									}, 'ad');
								}
						}
					}
					// 播放序号
					video_index_xh = ret.xh;
					video_index_i++;
					// console.log(JSON.stringify(di_data))
					console.log('播放序号：' + video_index_xh+" = ,video_index_i："+video_index_i)
					// if((video_index-1) <= video_index_xh){
					// 	// 记录上一次播放序号
					// 	video_index++;
					// 	add();
					// }

					if(video_index_xh >= 50){
						isPlaying();
						data_ajax();
					}else{
						// 判断欢看限制
						setTimeout(function(){
							if (_is_video()) {
								isPlaying();
								_suxiangw_msg();
								return;
							}else if(di_data.money){ // 是否付费观看
								_suxiangw_msg({content:'该视频需要付费'+di_data.money+_getPrefs('_config').zhibo.liwu_name,rightTitle:'同意付款',url:'fufei()'})
								isPlaying();
								return;
							}
						},300)
						// 判断结束
					}
					api.closeFrame({
						name: 'isPlaying'
					});
					api.execScript({
						frameName: 'time',
						script: 't(' + false + ');'
					});
					// console.log("video_index:"+video_index)


					// 增加点击统计
					if(di_data.user){
						_click(di_data.id);
					}else{
						_ajax('ad/click/id/'+di_data.id)
					}

					video_jindu();
					_click_member(di_data.id);
					// console.log(video_url_ajaxs)


					// if(ret.xh == 49 || ret.xh == 99 || ret.xh == 149 || ret.xh == 199 || ret.xh == 249 || ret.xh == 299){
					// 	data_ajax();
					// 	_msg('重新刷新')
					// }
				//	add();
					break;
				default:
			}
			//	console.log(ret.evenType)
			// console.log("播放页序号:" + ret.xh);

			// if(ret.xh>=1){
			// 	add();
			// }
			// console.log('===========================================================');
		});
		data_ajax();
		// 回到屏幕
		api.addEventListener({
			name: 'viewappear'
		}, function(ret, err) {
			isPlaying(true);
		});
		// 离开屏幕
		api.addEventListener({
			name: 'viewdisappear'
		}, function(ret, err) {
			isPlaying();
		});
		//应用进入后台事件
		api.addEventListener({
			name: 'pause'
		}, function(ret, err) {
			isPlaying();
		});
		// 应用从后台回到前台事件
		api.addEventListener({
			name: 'resume'
		}, function(ret, err) {
			// isPlaying(true);
		});
		// 监听倒计时开关
		api.addEventListener({
			name: 'time_jinbi'
		}, function(ret, err) {
			// alert(JSON.stringify(ret.value));
			if (ret.value.time_jinbi == true) {
				yuandu();
			} else {
				api.closeFrame({
					name: 'time'
				});
			}
		});

	}
	var video_url_ajaxs;
	function data_ajax() {
		// console.log(_getPrefs('_config').ad.kaiping+"ad_vip"+ad_vip)
		// if(_root==0 && _getPrefs('_config').ad.ad){
		// 	if(_getPrefs('_config').ad.kaiping == 2 && ad_vip){
		// 		api.showProgress({
		// 				modal: false
		// 		});
		// 		_url({
		// 			animation: true,
		// 			js: 'kaiping',
		// 			time_jinbi: time_jinbi,
		// 			time_jinbi_name: api.winName,
		// 			time_jinbi_frameName: api.frameName
		// 		}, 'ad');
		// 	}
		// }
		// console.log(JSON.stringify(api.pageParam))
		video_url_ajaxs = video_url_ajax;
		if ((api.pageParam['member']) && api.pageParam['data']) {
			if (di_data) {
				video_url_ajaxs = video_url_ajax + '/suid/' + di_data.uid + '/sid/' + di_data.id
			} else {
				if(api.pageParam['member'] == 'zuopin'){
					video_url_ajaxs = video_url_ajax + '/suid/' + api.pageParam['data']['uid'] + '/sid/' + api.pageParam['data']['id'];
				}else if(api.pageParam['member'] == 'xihuan'){
					video_url_ajaxs = video_url_ajax + '/xihuan/1/suid/' + api.pageParam['data']['xihuan_uid'] + '/sid/' + api.pageParam['data']['xihuan_id'];
				}else if(api.pageParam['member'] == 'shoucang'){
					video_url_ajaxs = video_url_ajax + '/xihuan/2/suid/' + api.pageParam['data']['shoucang_uid'] + '/sid/' + api.pageParam['data']['shoucang_id'];
				}else{
					// video_url_ajaxs = video_url_ajax + '/order/click/';
				}
			}
		}


		console.log(video_url_ajaxs)
		_ajax(video_url_ajaxs, function(ret, err) {

			if (ret) {
				data = [];
				if(di_data){
					data.push(find(di_data, 0));
				}
				if (api.pageParam['data']) {
					data.push(find(api.pageParam['data'], 0));
				}
				ret = ret.data;
				for (var i = 0; i < ret.length; i++) {
					data.push(find(ret[i], i));
					list_data.push(ret[i]);
				}
				scrollVideo.openScrollVideo({
					rect: {
						x: 0,
						y: 0,
						h: api.winHeight
					},
					userData: data,
					fixed: false,
					fixedOn: api.frameName,
				}, function(ret, err) {
					if (ret.status) {
						api.bringFrameToFront({
							from: 'index_header',
						});
						api.bringFrameToFront({
							from: 'index_footer',
						});
						goumai();
						// hongbao();
						if(api.winName=='root' && _root==1 && _getPrefs('_config').ad.ad){
							setTimeout(function() {
								if(_getPrefs('_config').ad.kaiping == 2 && ad_vip){
									_url({
										animation: true,
										js: 'kaiping',
										time_jinbi: time_jinbi,
										time_jinbi_name: api.winName,
										time_jinbi_frameName: api.frameName
									}, 'ad');
								}else{
									yuandu();
								}
							}, 300);
						}

						setTimeout(function() {
							api.hideProgress();
						}, 500);
						_root = 0;

					}
					//	console.log(JSON.stringify(ret) + "   " + JSON.stringify(err));
				});
			}
		})
	}
	// 防止重复请求
	var add_ajaxj = false;
	var ad_list_video_page = 1
	function add() {
		// if(add_ajaxj){
		// 	return;
		// }
		if((ad_list_video*ad_list_video_page) <= video_index_xh){
			ad_list_video_page ++;
			add_ad();
			return;
		}
	//	console.log((ad_list_video*ad_list_video_page) +":"+ video_index_xh);
		add_ajaxj = true;


		video_url_ajaxs = video_url_ajax;
		if ((api.pageParam['member']) && api.pageParam['data']) {
			if (di_data) {
				video_url_ajaxs = video_url_ajax + '/suid/' + di_data.uid + '/sid/' + di_data.id
			} else {
				if(api.pageParam['member'] == 'zuopin'){
					video_url_ajaxs = video_url_ajax + '/suid/' + api.pageParam['data']['uid'] + '/sid/' + api.pageParam['data']['id'];
				}else if(api.pageParam['member'] == 'xihuan'){
					video_url_ajaxs = video_url_ajax + '/xihuan/1/suid/' + api.pageParam['data']['xihuan_uid'] + '/sid/' + api.pageParam['data']['xihuan_id'];
				}else if(api.pageParam['member'] == 'shoucang'){
					video_url_ajaxs = video_url_ajax + '/xihuan/2/suid/' + api.pageParam['data']['shoucang_uid'] + '/sid/' + api.pageParam['data']['shoucang_id'];
				}else{
					// video_url_ajaxs = video_url_ajax + '/order/click/';
				}
			}
		}


		console.log(video_url_ajaxs)
		_ajax(video_url_ajax,function(ret,err){
			if(ret){
				if(ret.data){
					var a = ret.data[0];
					list_data.push(a);
					var data = find(a, 0);
					scrollVideo.addVideoData(data,function(ret,err){
						console.log("addVideoData:"+JSON.stringify(ret)+JSON.stringify(err))
					});
				//	console.log("addVideoData:"+video_index_xh)
					add_ajaxj = false;
					return;
					api.imageCache({
					    url: _img(a.img, api.winWidth, api.winHeight),
							thumbnail:false,
					}, function(ret, err) {
							if(ret.status){
								a.img = ret.url
							}
							// console.log(a.img);
							var data = find(a, 0,true);
							scrollVideo.addVideoData(data,function(ret,err){
								console.log("addVideoData:"+JSON.stringify(ret)+JSON.stringify(err))
							});
						//	console.log("addVideoData:"+video_index_xh)
							add_ajaxj = false;
					});
				}
			}
		})
	}
	function add_ad(){
		_ajax('ad/view/type/2',function(ret,err){
			if(ret){
				if(ret.ret.data){
					var ret = ret.ret.data;
					scrollVideo.addVideoData(find_ad(ret));
					add_ajaxj = false;
					return;
					api.imageCache({
					    url: _img(ret.img, api.winWidth, api.winHeight),
							thumbnail:false,
					}, function(a, r) {
							if(a.status){
								ret.img = a.url
							}
					});
				}
			}
		})
	}
	// 单独添加数据
	function find(ret, i,img_url) {
		if(ret.ad){
			return find_ad(ret.ad);
		}
		var a = {};
		a.uid = ret.id;
		a.imageUrl = img_url ? ret.img : _img(ret.img, api.winWidth, api.winHeight);
	//	console.log(a.imageUrl)
		// a.imageUrl = _i + 'loading_300.png';
		a.videoUrl = _sx_qiniu + ret.url;
		a.placeholderColor = ret.placeholderColor ? ret.placeholderColor : '#222';
		a.placeholderImage = _i+'loading_c.png';
		a.isLocalCache = api.systemType == 'ios' ? true : false;
		a.imageType = ret.imageType ? ret.imageType : 2;
		a.scalingMode = ret.scalingMode ? ret.scalingMode : (api.systemType == 'ios' ? 2 : 1);
		// console.log(a.scalingMode)
	//	console.log(ret.id+"scalingMode："+a.scalingMode)
		a.video = ret;

		var juli = 80; // 距离
		var num = api.winName == 'root' ? 4 : 3.5;
		var winW = api.winWidth;
		var winH = api.winHeight - (juli * num) - api.safeArea.bottom;

		var a_b = [];
		var b_s = {};
		var r = 15;
		var w = 35;
		var h = 35;
		var x = winW - (w + r);
		var y = winH;

		// 头像开始
		var b_s = {};
		var u = 16;
		b_s.x = x - (u / 2);
		b_s.y = y - (u + 20);
		b_s.w = w + u;
		b_s.h = h + u;
		b_s.pic = ret.user ? (ret.user.img ? _img(ret.user.img, 60, 60) : _i + 'touxiang.png') : _i + 'touxiang.png';
		b_s.type = 'button';
		b_s.isRadius = true;
		b_s.lineColor = '#fff';
		b_s.name = 'user';
		b_s.member_guanzhu = ret.member_guanzhu;
		a_b.push(b_s);

		if (!ret.member_guanzhu) {
			var b_s = {};
			var jian = 10;
			b_s.x = x + (jian / 2);
			b_s.y = y + jian - 10;
			b_s.w = w - jian;
			b_s.h = h - jian;
			b_s.pic = _i + 'index_jia.png';
			b_s.type = 'button';
			b_s.isRadius = true;
			b_s.name = 'user_jia';
			a_b.push(b_s);
		}

		// 头像结束
		// 点赞
		var b_s = {};
		y = y + 20;
		y = y + 30;
		b_s.x = x-2.5;
		b_s.y = y;
		b_s.w = w + 5;
		b_s.h = h + 5;
		b_s.pic = _i + 'zan' + (ret.user_zan ? '-s' : '') + '.png';
		b_s.type = 'button';
		b_s.name = 'zan';
		a_b.push(b_s);

		var b_s = {};
		y = y + 40
		b_s.x = x - 2.5;
		b_s.y = y + 2;
		b_s.w = w + 5;
		b_s.h = h + 5;
		b_s.type = 'text';
		b_s.text = ret.zan_num;
		b_s.textColor = '#fff';
		b_s.textSize = 16;
		b_s.gravity = 0
		b_s.name = 'zan_text';
		a_b.push(b_s);
		// 点赞结束
		// 评论开始
		var b_s = {};
		y = y + 20;
		y = y + 20;
		b_s.x = x;
		b_s.y = y;
		b_s.w = w;
		b_s.h = h;
		b_s.pic = _i + 'ping.png';
		b_s.type = 'button';
		b_s.gravity = 0;
		b_s.name = 'ping';
		a_b.push(b_s);

		var b_s = {};
		y = y + 40
		b_s.x = x;
		b_s.y = y;
		b_s.w = w;
		b_s.h = h;
		b_s.type = 'text';
		b_s.text = ret.ping_num;
		b_s.textColor = '#fff';
		b_s.textSize = 16;
		b_s.gravity = 0
		b_s.name = 'ping_text';
		a_b.push(b_s);
		// 评论结束
		// 分享开始
		var b_s = {};
		y = y + 20;
		y = y + 15;
		b_s.x = x;
		b_s.y = y;
		b_s.w = w;
		b_s.h = h;
		b_s.pic = _i + 'fen.png';
		b_s.type = 'button';
		b_s.gravity = 0;
		b_s.name = 'fen';
		a_b.push(b_s);
		// 分享结束
		if (i == 0) {
			_right_r = x;
			_right_h = y + 20;
		}
		// 音乐
		// var b_s = {};
		// y = y + 20;
		// y = y + 35;
		// b_s.x = x - 60;
		// b_s.y = y;
		// b_s.w = w;
		// b_s.h = h;
		// b_s.pic = _i + 'changpian.png';
		// b_s.type = 'music';
		// b_s.isRadius = true;
		// a_b.push(b_s);
		// 音乐结束
		// 左侧内容
		var b_s = {};
		x = 10;
		h = 120;
		y = y
		b_s.x = x;
		b_s.y = y;
		b_s.w = api.winWidth - w - 50;
		b_s.h = h;
		b_s.pic = _i + 'fen.png';
		b_s.type = 'text';
		b_s.text = ret.content;
		b_s.textSize = 16;
		b_s.gravity = 1;
		b_s.name = 'content';
		a_b.push(b_s);

		if(ret.shop_id){
		// 同款视频
			var b_s = {};
			h = 30;
			w = 80;
			if(api.systemType == 'ios'){
				y = y
			}else{
				y = y - 50
			}
			b_s.x = x;
			b_s.y = y;
			b_s.w = w;
			b_s.h = h;
			b_s.pic = _i + 'tongkuan.png';
			b_s.type = 'button';
			b_s.gravity = 0;
			b_s.name = 'tongkuan';
			// b_s.lineColor = '#fff';
			a_b.push(b_s);

			var b_s = {};
			b_s.x = x;
			b_s.y = y;
			b_s.w = w;
			b_s.h = h;
			b_s.type = 'text';
			b_s.text = '同款商品';
			b_s.textColor = '#fff';
			b_s.textSize = 16;
			b_s.gravity = 0
			b_s.name = 'tongkuan';
			a_b.push(b_s);
		}
		//
		// var b_s = {};
		// b_s.x = 0;
		// b_s.y = 100;
		// b_s.w = api.winWidth;
		// b_s.h = 1;
		// b_s.type = 'seekBar';
		// b_s.progress = 70;
		// b_s.leftColor='#f00';
		// b_s.rightColor='#ddd';
		// b_s.name = 'jindu';
		// a_b.push(b_s);


		// 跑马灯
		// var b_s = {};
		// x = 10;
		// h = 120;
		// y = y + 30;
		// b_s.x = x;
		// b_s.y = y;
		// b_s.w = 100;
		// b_s.h = h;
		// b_s.pic = _i + 'fen.png';
		// b_s.type = 'autoText';
		// b_s.text = '@'+ret[i].user.username+"原声";
		// b_s.textSize = 16;
		// b_s.gravity = 1;
		// b_s.name = 'content';
		// a_b.push(b_s);
		// a.styles = a_b;
		// data.push(a);

		a.styles = a_b;
		return a;
	}
	function find_ad(ret){
		var a = {};
		a.uid = '9999999999'+ret.id;
		a.imageUrl = ret.img ? _img(ret.img, api.winWidth, api.winHeight) : ret.img;
		a.videoUrl = _sx_qiniu + ret.video;
		a.placeholderColor = '#222';
		a.isLocalCache = api.systemType == 'ios' ? true : true;
		a.imageType = 2;
		a.scalingMode = (api.systemType == 'ios' ? 2 : 1);
		a.video = ret;

		var a_b = [];
		var b_s = {};
		var x = 15;
		var h = 60;
		var w = api.winWidth - (x*2);
		var y = api.winHeight - h - 120 - api.safeArea.bottom

		// 广告标志
		b_s.x = x;
		b_s.y = y - h + 25;
		b_s.w = 50;
		b_s.h = 25;
		b_s.pic = _i + 'ad_text.png';
		b_s.type = 'button';
		b_s.gravity = 0;
		b_s.name = 'ad';
		a_b.push(b_s);
		// 广告标志文字
		var b_s = {};
		b_s.x = x;
		b_s.y = y - h + 30;
		b_s.w = 50;
		b_s.h = 20;
		b_s.type = 'text';
		b_s.text = '广告';
		b_s.textColor = '#fff';
		b_s.textSize = 12;
		b_s.gravity = 0
		b_s.name = 'ad';
		a_b.push(b_s);
		// 广告内容
		var b_s = {};
		b_s.x = x;
		b_s.y = y;
		b_s.w = w;
		b_s.h = h;
		b_s.type = 'text';
		b_s.text = ret.content;
		b_s.textSize = 16;
		b_s.gravity = 1;
		b_s.name = 'ad';
		a_b.push(b_s);
		// 广告链接按钮
		var b_s = {};
		b_s.x = x;
		b_s.y = y + h + 10;
		b_s.w = 200;
		b_s.h = 38;
		b_s.pic = _i + 'ad_an.png';
		b_s.type = 'button';
		b_s.gravity = 0;
		b_s.name = 'ad';
		a_b.push(b_s);
		// 广告链接按钮文字
		var b_s = {};
		b_s.x = x;
		b_s.y = y + h + 20;
		b_s.w = 200;
		b_s.h = 38;
		b_s.type = 'text';
		b_s.text = '查看详细 > ';
		b_s.textColor = '#fff';
		b_s.textSize = 14;
		b_s.gravity = 0
		b_s.name = 'ad';
		a_b.push(b_s);
		a.styles = a_b
		return a;
	}

	function styles(ret) {
		var a = ret.itemData.styles;
		// 读取第一个关注
		var guanzhu = a[0].member_guanzhu;
		var i = guanzhu ? 0 : 1;
		// 结束
		//  console.log(ret.clickData.name)
		if (ret.clickData) {
			switch (ret.clickData.name) {
				case 'user':
					_u(ret.itemData.video.uid);
					return;
					break;
				case 'user_jia':
					if(!_getPrefs('_user')){
						return _login();
					}
					a.splice(1, 1);
					a[0]['member_guanzhu'] = true;
					_guanzhu(ret.itemData.video.uid);
					_zhen();
					break;
				case 'zan':
					if(!_getPrefs('_user')){
						return _login();
					}
					if (ret.clickData.pic == 'widget://www_suxiangw_com/i/zan-s.png') {
						a[i + 1]['pic'] = _i + "zan.png";
						if(a[i + 2]['text'].indexOf('w') == -1){
							a[i + 2]['text'] = parseInt(a[i + 2]['text']) - 1;
						}
					} else {
						a[i + 1]['pic'] = _i + "zan-s.png";
						if(a[i + 2]['text'].indexOf('w') == -1){
							a[i + 2]['text'] = parseInt(a[i + 2]['text']) + 1;
						}
						_zhen();
					}
					_zan(ret.itemData.video.id);
					break;
				case 'zan_text':
						if(!_getPrefs('_user')){
							return _login();
						}
						if (ret.clickData.pic == 'widget://www_suxiangw_com/i/zan-s.png') {
							a[i + 1]['pic'] = _i + "zan.png";
							if(a[i + 2]['text'].indexOf('w') == -1){
								a[i + 2]['text'] = parseInt(a[i + 2]['text']) - 1;
							}
						} else {
							a[i + 1]['pic'] = _i + "zan-s.png";
							if(a[i + 2]['text'].indexOf('w') == -1){
								a[i + 2]['text'] = parseInt(a[i + 2]['text']) + 1;
							}
							_zhen();
						}
						_zan(ret.itemData.video.id);
						break;
				case 'ping':
					_ping(ret.itemData.video.id, ret.itemData.video.ping_num, true);
					return;
				case 'ping_text':
					_ping(ret.itemData.video.id, ret.itemData.video.ping_num, true);
					return;
				case 'fen':
					_fenxiang(ret.itemData.video);
					return;
				case 'tongkuan':
					if(!_getPrefs('_user')){
						return _login();
					}
					_url({id:ret.itemData.video.shop_id},'shop_view_win');
					return;
					break;
				case 'ad':
					_ajax('ad/click/id/'+ret.itemData.video.id+'/zhanshi/1')
					_url({url:_sx_gurl+'index.php/index/m/ad/id/'+ret.itemData.video.id},'curl');
					return;
					break;
				default:
			}
		} else if (ret.evenType == 'onDoubleTap') {
			if(!_getPrefs('_user')){
				return _login();
			}
			a[i + 1]['pic'] = _i + "zan-s.png";
			a[i + 2]['text'] = parseInt(a[i + 2]['text']) + 1;
			_zhen();
			_zan(ret.itemData.video.id);
		}
		scrollVideo.updateVideoStyle({
			styles: a
		});
	}
	// 开始播放
	function isPlaying(a) {
		if (!a) {
			scrollVideo.pause();
			api.execScript({
				frameName: 'time',
				script: 't(' + true + ');'
			});
			isPlaying_open();
			video_jindu_set = true;
		} else {
			if (_is_video()) {
				return _suxiangw_msg();
			}else if(di_data && di_data.money){
				return _suxiangw_msg({content:'该视频需要付费'+di_data.money+_getPrefs('_config').zhibo.liwu_name,rightTitle:'同意付款',rightUrl:'fufei()'})
			}
			scrollVideo.play();
			api.execScript({
				frameName: 'time',
				script: 't(' + false + ');'
			});
			api.closeFrame({
				name: 'isPlaying'
			});
			video_jindu_set = false;
			video_jindu();
		}
	}

	function isPlaying_open() {
		url = 'isPlaying'
		api.openFrame({
			name: url,
			url: _h_w + url + '.html',
			rect: {
				x: api.winWidth / 2.25,
				y: api.winHeight / 2.4,
				w: 60,
				h: 60,
			},
			bgColor: 'rgba(0,0,0,0)',
		})
	}
	var time_jinbi = true;
	// 打开奖励圆度倒计时
	function yuandu() {
		// _tan({url:'index_user_renwu'})
		if (_getPrefs('_config').config.app == 1) {
			return;
		}else if(api.winName != 'root'){
			return;
		}else if (!_getPrefs('_config').time_show) {
			return;
		}
		if(_getPrefs('_config').hongbao.hongbao_show == 1){
			setTimeout(function(){
				url = 'hongbao_icon'
				api.openFrame({
					name: url,
					url: _h_w + url + '.html',
					rect: {
						x: 0,
						y: 0,
						w: 0,
						h: 0,
					},
					bgColor: 'rgba(0,0,0,0)',
				})
			},2000)
		}

		url = 'time';

		api.openFrame({
			name: url,
			url: _h_w + url + '.html',
			rect: {
				x: api.winWidth - 60,
				y: api.winHeight - _right_h,
				w: 58,
				h: 168,
			},
			bgColor: 'rgba(0,0,0,0)',
		})
		setTimeout(function(){
			if (_is_video()) {
				api.execScript({
					frameName: 'time',
					script: 't(' + true + ');'
				});
			}else if(di_data && di_data.money){
				api.execScript({
					frameName: 'time',
					script: 't(' + true + ');'
				});
			}
		},1000)
		// if(!_getPrefs('_token')){
		// 	setTimeout(function(){
		// 		_tan({
		// 				url: 'index_user_reg'
		// 		});
		// 	},1000);
		// }
	}
	// 付费视频观看
	function fufei() {
		if(!_getPrefs('_user')){
			return _login();
		}
		_loading('正在请求');
		_ajax('member/video_money', function(ret, err) {
			_loadingCloes();
			if (ret) {
				if (ret.ret) {
					_suxiangw_msg2({
						rightTitle: '立刻观看视频',
					}, function(ret) {
						if (ret.eventType == 'right') {
							// 付款成功更新视频
							di_data.money = 0;
							data_ajax();
							api.closeFrame({
								name: 'isPlaying'
							});
						}
						dialogBox.close({
							dialogName: 'alert'
						});
					});
				} else {
					_suxiangw_msg({content:ret.err,rightTitle:'立即充值',url:"_url({url: 'zhibo_view_frm_chongzhi',title: '充值'})"})
				}
			}
		}, {
			vid: di_data.id
		})
	}
	function goumai(){
		if (_getPrefs('_config').config.app == 1) {
			return;
		}
		if (_getPrefs('_config').config.goumai == 1) {
			return;
		}
		setTimeout(function(){
			url = 'a'
			api.openFrame({
				name: url,
				url: _h_w + url + '.html',
				rect: {
					x: 0,
					y: api.winHeight / 2,
					w: 120,
					h: 30,
				},
				bgColor: 'rgba(0,0,0,0)',
			})
		},3000)

	}
	function tan(url){
		api.openFrame({
			name: url,
			url: _h_w + url + '.html',
			rect: {
				x: 0,
				y: 0,
				w: 0,
				h: 0,
			},
			bgColor: 'rgba(0,0,0,0)',
		})
	}
	// 监听播放进度
	var video_jindu_set = false;
	function video_jindu(){
		if(!_getPrefs('_user')){
			return;
		}
		if(video_jindu_set){
			return;
		}
		if(!di_data){
			return;
		}
		var getDuration = scrollVideo.getDuration().duration/1000;
		var getCurrentPosition = scrollVideo.getCurrentPosition().currentPosition/1000;
	//	console.log('时长：'+(getDuration-1)+" ==  进度："+getCurrentPosition);
		if(parseInt(getCurrentPosition) >= parseInt(getDuration-1) ){
			video_jindu_set = false;
		//	console.log('播放结束');
			_click_member(di_data.id);
			return;
		}
		setTimeout(function(){
			video_jindu();
		},100)
	}

</script>

</html>
